#include<main.h>

void Search(STUDENT stu[], int s, int c)
{
	int i,j,p;
	long long ID;
	printf("    --进入查询模块--\n");
	printf("输入命令:\n0.按学号查询\1.按姓名查询\n");
	scanf_s("%d", &p);
	switch (p)
	{
	case 0:
		printf("输入用于查询的姓名:");
		scanf_s("%lld", &ID);
		for (i = 0; i < s; i++)
		{
			if (stu[i].ID == ID)
			{
				printf("%lld  %s  ", stu[i].ID, stu[i].Name);
				for (j = 0; j < c; j++)
				{
					printf("%.1f  ", stu[i].Grade[j]);
				}
				printf("\n");
			}
		}
		break;
	case 1:
		printf("    --进入查询(姓名)模块--\n");
		int i, j;
		char Name[20];
		printf("输入用于查询的姓名:");
		scanf_s("%s", &Name, sizeof(Name));
		for (i = 0; i < s; i++)
		{
			if (strcmp(stu[i].Name, Name) == 0)
			{
				printf("%lld  %s  ", stu[i].ID, stu[i].Name);
				for (j = 0; j < c; j++)
				{
					printf("%.1f  ", stu[i].Grade[j]);
				}
				printf("\n");
			}
		}
		break;
	default:
		break;
	}

}